#-*-coding:utf-8-*-
'''
file : date.py
provide usefulinterface to datetime, time ... modules
'''

from datetime import datetime

def now(date=True, time=False):
    '''
    returns the current datetime in a tuple form
    '''
    return datetime.today()

def get_now(dtformat="%Y-%m-%d"):
    '''
    returns a formatted string of current timestamp
    @param dtformat: the format of datetime in this form :
        %tag1 ...%tag2 ... with %tagn among these ones :
        %Y : year
        %m : month
        %d : day
        %H : hour
        %M : minute
        %S : seconds
    @example: %Y-%m-%d %H:%M:%S returns '2010-07-04 12:15:58'
    '''
    dateformat = '{0:%s}' % dtformat
    return dateformat.format(now())

def get_time(sep=":"):
    '''
    calls get_now with time arguments
    '''
    fields = ["%H","%M","%S"]
    return get_now(sep.join(fields))

def get_date(sep='-'):
    '''
    calls get_now with date arguments
    '''
    fields = ["%Y","%m","%d"]
    return get_now(sep.join(fields))

if __name__ == '__main__':
    print get_date()